diff options
Diffstat (limited to 'app/[lng]/evcp/(evcp)/bid/page.tsx')
| -rw-r--r-- | app/[lng]/evcp/(evcp)/bid/page.tsx | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/app/[lng]/evcp/(evcp)/bid/page.tsx b/app/[lng]/evcp/(evcp)/bid/page.tsx index 7480ce88..0e129e8a 100644 --- a/app/[lng]/evcp/(evcp)/bid/page.tsx +++ b/app/[lng]/evcp/(evcp)/bid/page.tsx @@ -1,36 +1,45 @@ import { Suspense } from "react" import { Shell } from "@/components/shell" import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" -import { - getBiddings, - getBiddingStatusCounts, +import { + getBiddings, + getBiddingStatusCounts, getBiddingTypeCounts, getBiddingManagerCounts, - getBiddingMonthlyStats + getBiddingMonthlyStats } from "@/lib/bidding/service" import { searchParamsCache } from "@/lib/bidding/validation" import { BiddingsPageHeader } from "@/lib/bidding/list/biddings-page-header" import { BiddingsStatsCards } from "@/lib/bidding/list/biddings-stats-cards" import { BiddingsTable } from "@/lib/bidding/list/biddings-table" +import { getValidFilters } from "@/lib/data-table" +import { type SearchParams } from "@/types/table" export const metadata = { title: "입찰 목록", description: "입찰 공고를 생성하고 진행 상황을 관리할 수 있습니다.", } -interface BiddingsPageProps { - searchParams: Record<string, string | string[] | undefined> +interface IndexPageProps { + searchParams: Promise<SearchParams> } -export default async function BiddingsPage({ searchParams }: BiddingsPageProps) { +export default async function BiddingsPage(props: IndexPageProps) { // ✅ nuqs searchParamsCache로 파싱 (타입 안전성 보장) + const searchParams = await props.searchParams const search = searchParamsCache.parse(searchParams) + + const validFilters = getValidFilters(search.filters) + // ✅ 모든 데이터를 병렬로 로드 const promises = Promise.all([ - getBiddings(search), + getBiddings({ + ...search, + filters: validFilters, + }), getBiddingStatusCounts(), - getBiddingTypeCounts(), + getBiddingTypeCounts(), getBiddingManagerCounts(), getBiddingMonthlyStats(), ]) @@ -52,14 +61,14 @@ export default async function BiddingsPage({ searchParams }: BiddingsPageProps) {/* ═══════════════════════════════════════════════════════════════ */} {/* 메인 테이블 */} {/* ═══════════════════════════════════════════════════════════════ */} - <Suspense + <Suspense fallback={ - <DataTableSkeleton - columnCount={20} - searchableColumnCount={3} - filterableColumnCount={4} + <DataTableSkeleton + columnCount={20} + searchableColumnCount={3} + filterableColumnCount={4} cellWidths={["10rem", "8rem", "12rem", "15rem", "10rem", "8rem"]} - shrinkZero + shrinkZero /> } > @@ -72,16 +81,16 @@ export default async function BiddingsPage({ searchParams }: BiddingsPageProps) // ═══════════════════════════════════════════════════════════════ // 통계 카드 래퍼 컴포넌트 // ═══════════════════════════════════════════════════════════════ -async function BiddingsStatsCardsWrapper({ - promises -}: { +async function BiddingsStatsCardsWrapper({ + promises +}: { promises: Promise<[ Awaited<ReturnType<typeof getBiddings>>, Awaited<ReturnType<typeof getBiddingStatusCounts>>, Awaited<ReturnType<typeof getBiddingTypeCounts>>, Awaited<ReturnType<typeof getBiddingManagerCounts>>, Awaited<ReturnType<typeof getBiddingMonthlyStats>> - ]> + ]> }) { const [biddingsResult, statusCounts, typeCounts, managerCounts, monthlyStats] = await promises |
